# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=allegro
pkgver=5.2.9.1
pkgrel=0
arch="all"
url="https://liballeg.org"
pkgdesc="Portable library mainly aimed at video game and multimedia programming"
license="BSD-3-Clause"
makedepends="
	alsa-lib-dev
	cmake
	flac-dev
	glu-dev
	gtk+3.0-dev
	libjpeg-turbo-dev
	libtheora-dev
	libvorbis-dev
	libwebp-dev
	libxcursor-dev
	libxi-dev
	mesa-dev
	pulseaudio-dev
	samurai
	xorg-server-dev
	"
source="https://github.com/liballeg/allegro5/releases/download/$pkgver/allegro-$pkgver.tar.gz"
subpackages="$pkgname-dev"

build() {
	# sdl2 is disabled for now as it's experimental still
	# and the tests are crashing on it
	# https://github.com/liballeg/allegro5/issues/1229
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DALLEGRO_SDL=OFF \
		-DWANT_TESTS=ON \
		-DWANT_EXAMPLES=OFF \
		-DWANT_DEMO=OFF
	cmake --build build
}

check() {
	cd build
	tests/test_driver --no-display ../tests/test_*.ini
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9b5fcaeda0ec229d4325a921d4765030de2c4169a750ec2084ad978d740b89a86d7db544088920f4438b0f9a9061068c1b8bc56b87898614d278282584853e10  allegro-5.2.9.1.tar.gz
"
